package me.jiatao.wan.ui.fragment

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentFactory
import me.jiatao.wan.ui.main.home.HomeFragment
import me.jiatao.wan.ui.main.mine.MineFragment
import me.jiatao.wan.ui.main.project.ProjectFragment
import me.jiatao.wan.ui.main.system.SystemFragment
import me.jiatao.wan.ui.main.wechat.WechatFragment

/**
 * @Author: taojia
 * @CreateDate: 2021/8/27 11:17 上午
 * @Version: 1.0
 * @Description: 自定义Fragment工厂
 */

class MainFragmentFactory : FragmentFactory() {
    override fun instantiate(classLoader: ClassLoader, className: String): Fragment {
        when (className) {
            HomeFragment::class.java.name -> return HomeFragment()
            ProjectFragment::class.java.name -> return ProjectFragment()
            WechatFragment::class.java.name -> return WechatFragment()
            SystemFragment::class.java.name -> return SystemFragment()
            MineFragment::class.java.name -> return MineFragment()
        }
        return super.instantiate(classLoader, className)
    }
}